﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using KMFrame.Permission.Util;
using LGCourt.Logic.BLL;

namespace lgweb.user
{
    public partial class changepassword : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!SessionBox.CheckUserSession())
            {
                Response.Redirect("/user/login.aspx");
            }
            
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            UserInfo bll = new UserInfo();

            int _userID = SessionBox.GetUserSession().UserID;
            UserPassword param = new UserPassword();
            param.OldPassWord = this.txtOldPwd.Value;
            param.NewPassWord = this.txtNewPwd.Value;
            param.UserID = _userID;

            bool result = (bool)bll.ChangePassword(param);

            if (result)
            {
                this.tdMessages.InnerHtml = "修改成功！";
            }
            else
            {
                this.tdMessages.InnerHtml = "修改失败！";
            }
        }
    }
}